var mongoose = require("mongoose");
	Page = require("./public/page"),
    db = mongoose.connection,
	gossipSchema = new mongoose.Schema({
		content : {type : String , required : true},
		isShow : {type : Number , default : 0},
		releaseTime : {type : String , required : true , default : new Date().getTime()}
	}),
    gossipS = db.model("gossip" , gossipSchema);
//方法
function Gossip(){};
//获取
Gossip.prototype.getGossip = function(data , callback){
   	//分页
	Page(data , gossipS , callback);
};
//添加
Gossip.prototype.addGossip = function(data , callback){
	gossipS.create(data , function(error , data){
		if(error){
			return callback(error);
		}else{
			return callback(null , data);
		};
	});
};
//删除
Gossip.prototype.delGossip = function(data , callback){
	gossipS.remove(data , function(error , data){
		if(error){
			return callback(error);
		};
		return callback(null , data);
	});
};
module.exports = Gossip;